﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wolfy.NetDisk.Core.Model;

namespace Wolfy.NetDisk.Core.Repository
{
    /// <summary>
    /// 单元仓储接口
    /// </summary>
    public interface IUnitRepository
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        T Insert<T>(T entity) where T : Entity, new();
        /// <summary>
        /// 保存
        /// </summary>
        void Save();
        /// <summary>
        /// 根据id查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        T Get<T>(int id) where T : Entity;
        /// <summary>
        /// 查询所有是否删除的实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="showDeleted"></param>
        /// <returns></returns>
        IEnumerable<T> GetAll<T>(bool showDeleted) where T : DeleteEntity;
    }
}
